package com.ruoyi.web.controller.pv;


import cn.hutool.log.StaticLog;
import com.doudou.core.container.ListUtil;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.aliyun.MySms;
import com.ruoyi.system.service.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

/**
 * 实训预约Controller
 *
 * @author zzx
 * @date 2023-04-22
 */
@RestController
@RequestMapping("/pv/sms")
public class SmsController extends BaseController {

    @Autowired private MySms sms;

    @Autowired private ISysUserService userService;


    @GetMapping("/list")
    public TableDataInfo list() {
        return getDataTable(sms.getAllTemplate());
    }



//    @GetMapping("/save-me")
//    public AjaxResult save() {
//        List<SysUser> sysUsers = userService.selectUserList(SysUser.builder().userType("2").build());
//        List<String> names = ListUtil.list(true);
//        for (SysUser sysUser : sysUsers) {
//            try {
//                sms.sendSave(sysUser.getPhonenumber(), sysUser.getNickName());
//                names.add(sysUser.getNickName());
//            } catch (Exception e) {
//                StaticLog.error(e);
//            }
//        }
//        return AjaxResult.success(names);
//    }

}
